package com.neusoft.lohas.modules.ivm.entity.mall;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import com.google.common.collect.Lists;
import com.neusoft.lohas.common.persistence.IdEntity;
/**
 * 商圈PC端首页热点图片entity
 * @author jackie.liu
 * @version 2015-04-09
 */
@Entity
@Table(name = "ivm_mall_index_photo")
@DynamicInsert
@DynamicUpdate
public class IndexPhoto extends IdEntity<IndexPhoto> {

	private static final long serialVersionUID = 1L;
	private String logoUrl; //图片地址
	private int sort; //排序号
	
	private List<IndexHot> hotList = Lists.newArrayList(); // 热点位置列表
	
	public IndexPhoto() {
		super();
		this.sort = 30;
	}

	public IndexPhoto(String id) {
		this();
		this.id = id;
	}
	
	public String getLogoUrl() {
		return logoUrl;
	}

	public void setLogoUrl(String logoUrl) {
		this.logoUrl = logoUrl;
	}

	public int getSort() {
		return sort;
	}

	public void setSort(int sort) {
		this.sort = sort;
	}

	@OneToMany(cascade = { CascadeType.ALL }, fetch = FetchType.LAZY, mappedBy = "indexPhoto")
	@Where(clause="del_flag='"+DEL_FLAG_NORMAL+"'")
	@OrderBy("create_date")
	@NotFound(action = NotFoundAction.IGNORE)
	public List<IndexHot> getHotList() {
		return hotList;
	}

	public void setHotList(List<IndexHot> hotList) {
		this.hotList = hotList;
	}
	
}
